package com.xyy.saas.payment.service.impl;

import com.xyy.saas.payment.dao.mapper.ProfitSharingMapper;
import com.xyy.saas.payment.dao.model.ProfitSharing;
import com.xyy.saas.payment.service.ProfitSharingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProfitSharingServiceImpl implements ProfitSharingService {

    @Autowired
    private ProfitSharingMapper profitSharingMapper;

    @Override
    public int insert(ProfitSharing entity) {
        return profitSharingMapper.insert(entity);
    }

    @Override
    public ProfitSharing selectById(Long id) {
        return profitSharingMapper.selectById(id);
    }

    @Override
    public List<ProfitSharing> selectByParam(ProfitSharing param) {
        return profitSharingMapper.selectByParam(param);
    }

    @Override
    public int updateSelective(ProfitSharing entity) {
        return profitSharingMapper.updateByPrimaryKeySelective(entity);
    }

    @Override
    public ProfitSharing deleteById(Long id) {
        ProfitSharing profitSharing = profitSharingMapper.selectById(id);
        int rows = profitSharingMapper.deleteById(id);
        if(rows < 1) {
            return null;
        }
        return profitSharing;
    }
}